﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>微街秀 > 推荐人ID</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <link rel="stylesheet" type="text/css" href="css/css.css" />
    <link href="css/ParentID.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-2.1.4.min.js" type="text/javascript"></script>
    <script src="js/ajax-data.js" type="text/javascript"></script>
    <script src="js/base.js" type="text/javascript"></script>
    <script src="js/dialog.js" type="text/javascript"></script>
      <script type="text/javascript">
          $(document).ready(function () {
              ajax.getAjax("Ajax/user.ashx?getagentid", "login=true", function (date) {
                  if (date.code == 0) {
                      $("#nicknametext").val(date.item.agentid)
                      $("#refID").val(date.item.agentid);
                  }
              });

              $(".nicksave").click(function () {
                  var id = $("#nicknametext").val();
                  var reg = new RegExp("^[0-9]*$");
                  
                  if (id == "") {
                      $("#nicknametext").val("0");
                      id = "0";
                  }
                  if ($("#refID").val() != "" && $("#refID").val() != "0") {
                      Alert("填写后不允许修改！");
                      return;
                  }
                  if (!reg.test(id)) {
                      Alert("请输入数字");
                      return;
                  }
                  if (!/^[0-9]*$/.test(id)) {
                      Alert("请输入数字");
                      return;
                  }
                  ajax.UpdateInfo("agentid=" + id, function (data) {
                      if (data.code == "成功") {
                          Alert("保存成功");
                      }
                      else {
                          Alert(data.msg);
                      }
                  });

              });
          });
      </script>
</head>
<body>
    <div>
    <input type="hidden" id="refID" value="0" />
        <div class="wamtop">
            <div class="topleft" onclick="window.location.href='Set.html'">             
                    <img src="img/5.jpg" />
            </div>
            <div class="topcententxt">
                推荐人ID
            </div>
        </div>
        <div class="nickname">
            <input type="text" class="nicknametext" id="nicknametext" placeholder="请填写数字"/>
        </div>
        <div class="pareid">注：推荐人ID为数字，没有请填写0，提交后不允许再次修改！</div>
        <div class="nicksave">
            <div style="font-size: 16px;  color: White;">
            确定</div>
        </div>
    </div>
</body>
</html>
